# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer:
pkgname=libphutil
pkgver=0_git20180717
pkgrel=0
pkgdesc="A collection of PHP utility classes"
url="http://www.phabricator.com/docs/libphutil/"
arch="noarch"
license="Apache-2.0"
depends="php7 php7-curl php-json"
options="!check" # no checks
subpackages=""
source="https://dev.alpinelinux.org/archive/libphutil/libphutil-$pkgver.tar.gz"
builddir="$srcdir/libphutil-stable"

build() {
	:
}

package() {
	cd "$builddir"
	mkdir -p "$pkgdir"/usr/share/php/$pkgname \
		"$pkgdir"/usr/bin
	for i in externals resources scripts src support; do
		cp -r "$builddir"/$i "$pkgdir"/usr/share/php/$pkgname/
	done
	ln -sf /usr/share/php/$pkgname/scripts/utils/aws-s3.php \
		"$pkgdir"/usr/bin/aws-s3
}

snapshot() {
	local pkgver=0_git$(date +%Y%m%d)
	msg "Grabbing the latest stable snapshot"
	mkdir -p "$srcdir"
	wget -O "$srcdir"/$pkgname-$pkgver.tar.gz \
		https://github.com/phacility/libphutil/archive/stable.tar.gz
	ssh distfiles.alpinelinux.org \
		"mkdir -p archive/$pkgname/"
	scp "$srcdir"/$pkgname-$pkgver.tar.gz \
		dev.alpinelinux.org:/archive/$pkgname/
	sed -i -e "s/^pkgver=.*/pkgver=$pkgver/" \
		"$startdir"/APKBUILD
	sed -i -e "s/^pkgrel=.*/pkgrel=0/" \
		"$startdir"/APKBUILD
	abuild checksum
}

sha512sums="44f1c268ecfc27f4479c1a57870cc6730822cd7cfb6ef875c0eb7889f5eb8acc0e57708c08f629264db473c963f7e4ae7646434c5e9c477b3c001edc53bde751  libphutil-0_git20180717.tar.gz"
